import request from '@/utils/request'
import { AxiosPromise } from 'axios'

enum Api {
  list = '/deviceSupplier/list',
  del = '/deviceSupplier/delete',
  save = '/deviceSupplier/edit',
  all = '/deviceSupplier/getAll',
}
export interface IDeviceSupplierVO {
  createAt: number
  createBy: number
  createDept: number
  createTime: string
  id?: string
  name: string
  updateBy: number
  updateTime: string
}

interface IPage {
  pageSize: number
  pageNum: number
}
// 获取列表
export const getDeviceSupplierList = (data?: IPage): AxiosPromise<any> => {
  return request({
    url: Api.list,
    method: 'post',
    data,
  })
}

// 获取所有
export const getDeviceSupplierAll = (): AxiosPromise<IDeviceSupplierVO[]> => {
  return request({
    url: Api.all,
    method: 'post',
  })
}

// 删除
export const deleteDeviceSupplier = (data: (string | number)[]) => {
  return request({
    url: Api.del,
    method: 'post',
    data,
  })
}

// 编辑、保存
export const saveDeviceSupplier = (data: IDeviceSupplierVO) => {
  return request({
    url: Api.save,
    method: 'post',
    data,
  })
}
